package com.googlecode.thriftbenchmark.twitter;

import org.apache.thrift.TException;



public class TwitterServiceImpl implements TwitterService.Iface{

    @Override
    public void ping() throws TException {
        
    }

    @Override
    public boolean postTweet(Tweet tweet, long delay) throws TException {
        
        if (delay > 0) {
            try {
                Thread.sleep(delay);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        
        return true;
    }

    @Override
    public TweetSearchResult searchTweets(String query, long delay) throws TException {
        
        if (delay > 0) {
            try {
                Thread.sleep(delay);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        
        return null;
    }

    @Override
    public void zip() throws TException {
        
    }

    @Override
    public Tweet postAndReturnTweet(Tweet tweet, long delay) throws TException {
        if (delay > 0) {
            try {
                Thread.sleep(delay);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return tweet;
    }

}
